<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateSystemNoticesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('system_notices', function (Blueprint $table) {
            $table->id();
            $table->string('title', 120)->default('')->comment('公告标题');
            $table->text('content')->nullable(true)->comment('公告内容');
            $table->string('additionalHide', 255)->default('')->comment('公告附加隐藏信息');
            $table->string('additionalShow', 255)->default('')->comment('公告附加展示信息');
            $table->unsignedInteger('type')->default(0)->comment('公告类型  0-默认 ...  与枚举同步');
            $table->unsignedInteger('startTime')->default(0)->comment('公告有效开始时间');
            $table->unsignedInteger('endTime')->default(0)->comment('公告有效结束时间');
            $table->unsignedInteger('presenceArea')->default(0)->comment('公告存在区域  0-任意页  1-APP首页  2-订货页 ... 与枚举同步');
            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('createdByUid')->default(0)->comment('创建人');
            $table->unsignedInteger('updatedAt')->default(0)->comment('修改时间');
            $table->unsignedInteger('updatedByUid')->default(0)->comment('修改人');
            $table->tinyInteger('isDeleted')->default(0)->comment('是否删除');
            $table->collation = 'utf8mb4_general_ci';
            $table->index(['startTime', 'endTime'], 'idx_time');
            $table->comment = '系统公告表';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('system_notices');
    }
}
